package iceworld.fernado.entity;

import iceworld.fernado.consts.Constants;

public class Field implements IEntity, Comparable<Field> {

	private static final long serialVersionUID = 1L;
	private String name;
	private String zhName;
	private String type;
	private boolean none;
	private String defaultValue;
	private String comment;
	private boolean primaryKey;

	@Override
	public String toString() {
		StringBuilder result = new StringBuilder();
		result.append("Field[");
		result.append("name=").append(name).append(Constants.COMMA).append(Constants.SPACE);
		result.append("zhName=").append(zhName).append(Constants.COMMA).append(Constants.SPACE);
		result.append("type=").append(type).append(Constants.COMMA).append(Constants.SPACE);
		result.append("none=").append(none).append(Constants.COMMA).append(Constants.SPACE);
		result.append("defaultValue=").append(defaultValue).append(Constants.COMMA).append(Constants.SPACE);
		result.append("primaryKey=").append(primaryKey).append(Constants.COMMA).append(Constants.SPACE);
		result.append("comment=").append(comment);
		result.append("]");
		return result.toString();
	}
	
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getZhName() {
		return zhName;
	}
	public void setZhName(String zhName) {
		this.zhName = zhName;
	}
	public String getType() {
		return type;
	}
	public void setType(String type) {
		this.type = type;
	}
	public boolean isNone() {
		return none;
	}
	public void setNone(boolean none) {
		this.none = none;
	}
	public String getDefaultValue() {
		return defaultValue;
	}
	public void setDefaultValue(String defaultValue) {
		this.defaultValue = defaultValue;
	}
	public boolean isPrimaryKey() {
		return primaryKey;
	}
	public void setPrimaryKey(boolean primaryKey) {
		this.primaryKey = primaryKey;
	}
	public String getComment() {
		return comment;
	}
	public void setComment(String comment) {
		this.comment = comment;
	}
	@Override
	public int compareTo(Field o) {
		return o.name.equals(name) ? 0 : 1;
	}
}
